package site.wuao.simpledesignmode.simplefactory.factory;

import site.wuao.simpledesignmode.simplefactory.Fresco;
import site.wuao.simpledesignmode.simplefactory.Glide;
import site.wuao.simpledesignmode.simplefactory.Picasso;
import site.wuao.simpledesignmode.simplefactory.base.AbstractImageLoader;

/**
 * 工厂类
 *
 * @author wuao
 * @date 2017/11/5
 * @github {https://github.com/CoderWuao}
 * @blogs {http://wuao.site/}
 * @note -
 * ---------------------------------------------------------------------------------------------------------------------
 * @modified -
 * @date -
 * @github -
 * @blogs -
 * @note -
 */
public class ImageLoaderFactory {
    /**
     * 生产图片加载器
     *
     * @param type 类型
     * @return 图片加载器对象
     */
    public static AbstractImageLoader createImageLoader(String type) {
        AbstractImageLoader abstractImageLoader = null;
        switch (type) {
            case "glid":
                abstractImageLoader = new Glide();
                break;
            case "picasso":
                abstractImageLoader = new Picasso();
                break;
            case "fresco":
                abstractImageLoader = new Fresco();
                break;
            default:
                break;
        }
        return abstractImageLoader;
    }
}
